/* eslint-disable no-param-reassign */

import { getStorageInfo } from '@/api/utils/storage-util';

/*
 * @Author: lirl
 * @Date: 2019-11-01 15:59:11
 * @Description: 用户信息
 */
const state = {
  userId: getStorageInfo('userId'),
  userName: getStorageInfo('userName'),
  userCode: getStorageInfo('userCode'),
  loginName: getStorageInfo('loginName'),
  orgCode: getStorageInfo('orgCode'),
  orgName: getStorageInfo('orgName'),
  identityId: getStorageInfo('identityId'),
  identityDefCode: getStorageInfo('identityDefCode'),
  treeId: getStorageInfo('treeId'),
  telphone: getStorageInfo('telphone')
};

const mutations = {
  setUser(states, payload) {
    states.userName = payload.userName;
    states.userId = payload.userId;
    states.userCode = payload.userCode;
    states.loginName = payload.loginName;
    states.orgName = payload.orgName;
    states.orgCode = payload.orgCode;
    states.identityId = payload.identityId;
    states.identityDefCode = payload.identityDefCode;
    states.treeId = payload.treeId;
    states.telphone = payload.telphone;
  },
};

export default {
  namespaced: true,
  state,
  mutations
};
